<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>科讯管理后台-登录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" th:href="@{/layuiadmin/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/layuiadmin/style/admin.css}" media="all">
    <link rel="stylesheet" th:href="@{/layuiadmin/style/login.css}" media="all">
    <style>
        .bgimg {
            width: 100%;
            height: 100%;
            position: fixed;
            background: url("/img/bg.png") no-repeat fixed;
            background-size: 100% 100%;
            box-sizing: border-box;
            z-index: 1;
        }


        .video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            object-position: left;
        }

    </style>
</head>
<body>
<div class="bgimg">
    <!--    <video  autoplay="true"  loop="" src="https://sf3-ttcdn-tos.pstatp.com/obj/mp/welcome-video.mp4" poster="https://sf3-ttcdn-tos.pstatp.com/obj/mp/welcome-video-poster-v2.png" class="video"></video>-->
</div>
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="z-index: 3">

    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>科讯管理后台</h2>
            <p>通用后台管理系统</p>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-username"
                       for="LAY-user-login-username"></label>
                <input type="text" name="username" id="LAY-user-login-username" value="" lay-verify="required"
                       placeholder="用户名"
                       class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-password"
                       for="LAY-user-login-password"></label>
                <input type="password" name="password" value="" id="LAY-user-login-password" lay-verify="required"
                       placeholder="密码" class="layui-input">
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-xs7">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-vercode"
                               for="LAY-user-login-vercode"></label>
                        <input type="text" name="captcha" id="LAY-user-login-vercode" lay-verify="required"
                               placeholder="图形验证码" class="layui-input">
                    </div>
                    <div class="layui-col-xs5">
                        <div style="margin-left: 10px;">
                            <img class="layadmin-user-login-codeimg"
                                 id="LAY-user-get-vercode">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item" style="margin-bottom: 20px;">
                <input type="checkbox" checked name="rememberMe" lay-skin="primary" title="记住密码">
                <a href="forget.html" class="layadmin-user-jump-change layadmin-link"
                   style="margin-top: 7px;color: #1E9FFF !important;">忘记密码？</a>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit"
                        style="background-color: #1E9FFF !important;">登 陆
                </button>
            </div>
        </div>
    </div>

    <div class="layui-trans layadmin-user-login-footer">
        <p style="color: #fff">© 2020 <a href="http://www.kexunsoftware.com" target="_blank">www.kexunsoftware.com</a>
        </p>
    </div>

</div>
<script>
    if (self != top) {
        window.open("/login", "_top")
    }
</script>
<script th:src="@{/layuiadmin/layui/layui.js}"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function () {
        var $ = layui.$,
            setter = layui.setter,
            admin = layui.admin,
            form = layui.form,
            router = layui.router(),
            search = router.search;
        refush()
        //提交
        form.on('submit(LAY-user-login-submit)', function (formData) {
            $.ajax({
                type: 'post',
                url: "/login",
                data: formData.field,
                beforeSend: function () {
                    layer.load(2); //风格1的加载
                },
                success: function (data) {
                    layer.closeAll('loading');
                    if (data.code == 0) {
                        location.href = '/index'
                    } else {
                        layer.msg(data.message, {icon: 2});
                        refush();
                        return false;
                    }
                },
                error: function (xhr, type) {
                    refush();
                    layer.msg("系统错误，请联系管理员！");
                }
            });

        });


        $("#LAY-user-get-vercode").click(function () {
            refush()
        })

        function refush() {
            $("#LAY-user-get-vercode").attr("src", "/kaptcha.jpg?date=" + new Date().getTime())
        }

    });
</script>
</body>
</html>
